 
import { create } from "zustand";
import { counterStore } from "./counterStore";
import { userStore } from "./userStore";
import { componentStore } from "./componentStore";
import { pageInfoStore } from "./pageInfoStore";
import type{ storeType } from "@/utils/type";

import { temporal } from "zundo";




export  const useStore =create<storeType>((...a)=>({
    ...counterStore(...a),
    ...userStore(...a),
    ...pageInfoStore(...a),
}))




// 单独创建带有时空旅行功能的 component store
export const useComponentStore = create(
  temporal(componentStore,{
    partialize: (state) =>{
      return {
        componentList:state.componentList
      }
    },
    limit:100,
   
  })
);
// 导出 temporal store
export const useTemporalStore = useComponentStore.temporal;
